<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var p1 = new Promise((resolve,reject)=>{
            //变成success
            // resolve(100);
            // setTimeout(()=>{
            //     resolve(100);
            // },2000)
            //拒绝，失败
            // reject();
            setTimeout(()=>{
                reject("数据获取失败！");
            },2000)
        })
        // console.log('p1',p1);
        p1.then(r=>{
            console.log('r',r);
        }).catch(e=>{
            console.log('e',e);
        })
    </script>
</body>
</html>